import 'package:bxultimate/app/theme/app_theme.dart';
import 'package:bxultimate/app/theme/gaps.dart';
import 'package:bxultimate/widgets/mk_page.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

import 'controller.dart';

class UserPrivacyDownloadInfoPage extends StatefulWidget {
  const UserPrivacyDownloadInfoPage({Key? key}) : super(key: key);

  @override
  State<UserPrivacyDownloadInfoPage> createState() =>
      _UserPrivacyDownloadInfoPageState();
}

class _UserPrivacyDownloadInfoPageState
    extends State<UserPrivacyDownloadInfoPage> {
  final controller = Get.find<UserPrivacyDownloadInfoController>();
  final state = Get.find<UserPrivacyDownloadInfoController>().state;

  @override
  Widget build(BuildContext context) {
    return MkPage(
        child: Scaffold(
      backgroundColor: Colors.transparent,
      appBar: TDNavBar(
        backgroundColor: Colors.transparent,
        title: '个人信息下载',
      ),
      body: Padding(
        padding: EdgeInsets.only(
            left: AppTheme.iDefaultPadding, right: AppTheme.iDefaultPadding),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              padding: EdgeInsets.all(AppTheme.iDefaultPadding),
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(8)),
              child: Text(
                '我们会把你的所有个人信息与发布的内容整理成TXT文件，并通过邮件把文件下载链接发送给你，从数据收集到发送这一过程可能需要3个工作日',
                style: TextStyle(color: Color(0xFF606266), fontSize: 12),
              ),
            ),
            Gaps.vGap8,
            Text('可下载的数据'),
            Gaps.vGap8,
            TDCell(
              title: '个人资料',
              leftIcon: Icons.account_circle,
              description: '包括用户名、头像、性别、生日、简介等',
              style: TDCellStyle(
                  descriptionStyle: TextStyle(color: Colors.grey, fontSize: 12),
                  backgroundColor: Colors.white),
            ),
            TDCell(
              title: '你发布的内容',
              leftIcon: Icons.library_books,
              description: '包含情报、工作动态等',
              style: TDCellStyle(
                  descriptionStyle: TextStyle(color: Colors.grey, fontSize: 12),
                  backgroundColor: Colors.white),
            ),
            Gaps.vGap32,
            TDButton(
              text: '申请个人信息下载',
              isBlock: true,
              theme: TDButtonTheme.primary,
              onTap: controller.applyDownload,
            )
          ],
        ),
      ),
    ));
  }

  @override
  void dispose() {
    Get.delete<UserPrivacyDownloadInfoController>();
    super.dispose();
  }
}
